/**
 * 
 */
package com.ly.hotel.view.common;


import com.ly.hotel.model.Ad;

/**
 * @author jouson 2014-7-11
 */
public class AdData {
	// 节点介绍
	private static Ad intro;
	// 直播
	private static Ad live;
	// 在线影音
	private static Ad vod;

	// 2014/11/5小朱新增 电视直播 音乐欣赏 网络浏览 触摸游戏广告
	private static Ad tv;
	private static Ad music;
	private static Ad network;
	private static Ad games;

	private AdData() {
	}

	public synchronized static void create(Ad ad) {
		if (ad == null) {
			return;
		}
		switch (ad.getType()) {
		case Ad.INTRO:
			if (ad != null && ad.getDetails() != null && !ad.getDetails().isEmpty()) {
				intro = ad;
			}
			break;
		case Ad.VOD:
			if (ad != null && ad.getDetails() != null && !ad.getDetails().isEmpty()) {
				vod = ad;
			}
			break;
		case Ad.LIVE:
			if (ad != null && ad.getDetails() != null && !ad.getDetails().isEmpty()) {
				live = ad;
			}
			break;
		case Ad.MUSIC:
			if (ad != null && ad.getDetails() != null && !ad.getDetails().isEmpty()) {
				music = ad;
			}
			break;
		case Ad.TV:
			if (ad != null && ad.getDetails() != null && !ad.getDetails().isEmpty()) {
				tv = ad;
			}
			break;
		case Ad.NETWORK:
			if (ad != null && ad.getDetails() != null && !ad.getDetails().isEmpty()) {
				network = ad;
			}
			break;
		case Ad.GAMES:
			if (ad != null && ad.getDetails() != null && !ad.getDetails().isEmpty()) {
				games = ad;
			}
			break;
		default:
			break;
		}

		// processOrder();
	}

	/*
	 * private static void processOrder() { AdDetailComparator comparator = new
	 * AdDetailComparator(); if (intro != null && intro.getDetails() != null) {
	 * Collections.sort(intro.getDetails(), comparator); } if (live != null &&
	 * live.getDetails() != null) { Collections.sort(live.getDetails(),
	 * comparator); } if (vod != null && vod.getDetails() != null) {
	 * Collections.sort(vod.getDetails(), comparator); } //2014/11/5小朱新增 电视直播
	 * 音乐欣赏 网络浏览 触摸游戏广告 if (tv != null && tv.getDetails() != null) {
	 * Collections.sort(tv.getDetails(), comparator); } if (music != null &&
	 * music.getDetails() != null) { Collections.sort(music.getDetails(),
	 * comparator); } if (games != null && games.getDetails() != null) {
	 * Collections.sort(games.getDetails(), comparator); } if (network != null
	 * && network.getDetails() != null) { Collections.sort(network.getDetails(),
	 * comparator); } }
	 */
	public static Ad getIntro() {
		return intro;
	}

	public static Ad getLive() {
		return live;
	}

	public static Ad getVod() {
		return vod;
	}

	public static Ad getMusic() {
		return music;
	}

	public static Ad getNetwork() {
		return network;
	}

	public static Ad getGames() {
		return games;
	}

	public static Ad getTv() {
		return tv;
	}

}
